package dk.simonvogensen.uirecorder.client;

import com.google.gwt.user.client.ui.*;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.ClickEvent;
import dk.simonvogensen.itodo.client.controller.Controller;

public class RecorderDialogBox extends DialogBox {
    public RecorderDialogBox(final Controller controller) {
        super(false, false);

        setText("Recorder");
        VerticalPanel vPanel = new VerticalPanel();

        HorizontalPanel hPanel = new HorizontalPanel();

        Button recordButton = new Button("Record", new ClickHandler() {
            public void onClick(ClickEvent event) {
                Utils.emptyRecorded();
                Utils.startRecording();
            }
        });
        hPanel.add(recordButton);

        Button stopButton = new Button("Stop", new ClickHandler() {
            public void onClick(ClickEvent event) {
                Utils.stopRecording();
            }
        });
        hPanel.add(stopButton);

        Button playButton = new Button("Play", new ClickHandler() {
            public void onClick(ClickEvent event) {
                Utils.play();
            }
        });
        hPanel.add(playButton);

        vPanel.add(hPanel);

        final TextArea importTextArea = new TextArea();
        importTextArea.setSize("100%", "300px");
        vPanel.add(importTextArea);

        Button closeButton = new RecordableButton("Close", new ClickHandler() {
            public void onClick(ClickEvent event) {
                hide();
            }
        });
        vPanel.add(closeButton);

        vPanel.setCellHorizontalAlignment(hPanel, HorizontalPanel.ALIGN_CENTER);
        setWidget(vPanel);
    }
}